import java.util.*;
class Main1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < array.length; i++){
            array[i] = in.nextInt();
        }
        Arrays.sort(array);
        System.out.println(count(array,n,0,0,1));
    }

    public static int count (int[] array,int n, int pos, int sum, int multi){
        int count = 0;
        for (int i = pos; i < n; i++){
            sum += array[i];
            multi *= array[i];
            if (sum > multi){
                count = count + 1 + count(array,n,i+1,sum,multi);

            }else if(array[i] == 1){
                count = count + count(array,n,i+1,sum,multi);

            }else{
                break;
            }
            sum = sum - array[i];
            multi = multi / array[i];
            while(i < n-1 && array[i] == array[i+1]){
                i++;
            }

        }
        return count;

    }
}
public class Test {
}
